<%@ include file="/html/portlet/ext/myprofile/init.jsp" %>
<%
	PortletURL url = renderResponse.createActionURL();
	url.setWindowState(WindowState.NORMAL);
	url.setParameter("struts_action", "/ext/myprofile/add_profile");
	url.setParameter("cmd", "ADD");	
	User selUser = UserLocalServiceUtil.getUserById(userId);
	long p_u_i_d = (selUser != null) ? selUser.getUserId() : 0 ;
	long portrait_id = (selUser != null) ? selUser.getPortraitId(): 0;
%>
<script type="text/javascript">
	function <portlet:namespace />changePortrait(newPortraitURL) {
		jQuery('#<portlet:namespace />avatar').attr('src', newPortraitURL);
		jQuery('.avatar').attr('src', newPortraitURL);

		jQuery('#<portlet:namespace />deletePortrait').val(false);
	}

	function <portlet:namespace />openEditUserPortraitWindow(editUserPortraitURL) {
		var editUserPortraitWindow = window.open(editUserPortraitURL, '<liferay-ui:message key="change" />', 'directories=no,height=400,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=500');

		editUserPortraitWindow.focus();
	}
</script>

<form name="fm" action=<%= url.toString() %> method="POST">
<center>
	<table width='100%' class='portlet-box' align='center' cellspacing="0" cellpadding="2">
		<tr class='results-header'>
		<td class='portlet-font' colspan='3' style='font-weight:bold;height:25px' nowrap>
		Add Profile
		</td>
		</tr>
		<tr class="portlet-section-body results-row">
		<td >My Photo:</td>

		<td >	
		<c:if test="<%= selUser != null %>">
			<portlet:renderURL windowState="<%= LiferayWindowState.POP_UP.toString() %>" var="editUserPortraitURL">
				<portlet:param name="struts_action" value="/ext/myprofile/file_book" />				
				<portlet:param name="redirect" value="<%= currentURL %>" />
				<portlet:param name="p_u_i_d" value="<%= String.valueOf(selUser.getUserId()) %>" />
				<portlet:param name="portrait_id" value="<%= String.valueOf(selUser.getPortraitId()) %>" />
			</portlet:renderURL>

			<a class="change-avatar" href="javascript: <portlet:namespace />openEditUserPortraitWindow('<%= editUserPortraitURL %>');"><img alt="<liferay-ui:message key="avatar" />" class="avatar" id="<portlet:namespace />avatar" src='<%= themeDisplay.getPathImage() %>/user_<%= selUser.isFemale() ? "female" : "male" %>_portrait?img_id=<%= selUser.getPortraitId() %>&t=<%= ImageServletTokenUtil.getToken(selUser.getPortraitId()) %>' /></a>

			<div class="portrait-icons">

				<%
				String taglibEditURL = "javascript: " + renderResponse.getNamespace() + "openEditUserPortraitWindow('" + editUserPortraitURL +"');";
				%>

				<liferay-ui:icon image="edit" message="change" url="<%= taglibEditURL %>" label="<%= true %>" />

				
			</div>
		</c:if>
		</td>
		</tr>	
		<%if(!(selUser.getComments().equals("student")||(selUser.getComments().equals("collStudent")))){%>
		<tr class = "portlet-section-body results-row alt">
		<td>Education :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />education" rows="3" cols="45"></textarea></td>
		</tr>	
		<tr class = "portlet-section-body results-row ">
		<td>Employment :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />employment" rows="3" cols="45"></textarea></td>
		</tr>
		<tr class = "portlet-section-body results-row alt">
		<td>Experience :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />experience" rows="3" cols="45"></textarea></td>
		</tr>
		<%}%>	
		<%if(!(selUser.getComments().equals("school")||(selUser.getComments().equals("college")))){%>
		<tr class = "portlet-section-body results-row">
		<td>Family Details:</td>
		<td><textarea name="<portlet:namespace />family" rows="3" cols="45"></textarea></td>
		</tr>		
		
		<tr class = "portlet-section-body results-row alt">
		<td>Strength :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />strength" rows="3" cols="45"></textarea></td>
		</tr>
		
		<tr class = "portlet-section-body results-row ">
		<td>Interests :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />interests" rows="3" cols="45"></textarea></td>
		</tr>

		<tr class = "portlet-section-body results-row alt">
		<td>Goals :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />goals" rows="3" cols="45"></textarea></td>
		</tr>		

		<tr class = "portlet-section-body results-row">
		<td>Hobbies :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />hobbies" rows="3" cols="45"></textarea></td>
		</tr>		
		<tr class = "portlet-section-body results-row alt">
		<td>AboutMe :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />aboutMe" rows="3" cols="45"></textarea></td>
		</tr>		
		
		<tr class = "portlet-section-body results-row">
		<td>MyFavoirate :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />myFavoirate" rows="3" cols="45"></textarea></td>
		</tr>
		
		<tr class = "portlet-section-body results-row alt">
		<td>Languages :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />languages" rows="3" cols="45"></textarea></td>
		</tr>
		
		<tr class = "portlet-section-body results-row ">
		<td>Weakness :<font color="red" style = "font-size: medium;">*</font></td>
		<td><textarea name="<portlet:namespace />weakness" rows="3" cols="45"></textarea></td>
		</tr>
		<%}%>

	</table>  
	<br>
	
	<table align='center'>
		<tr class="portlet-form-button">	
			<td>
				<input type="submit" value="Save"  />
				<input type="reset" value="Reset" />
				<input type="button"  value='Cancel' onClick='history.go(-1)'>
			</td>
		</tr>
	</table>
  </center>
</form>
